package com.ou.csbs.capstone.models;

import gov.nasa.worldwind.render.BasicShapeAttributes;
import gov.nasa.worldwind.render.Material;
import gov.nasa.worldwind.render.ShapeAttributes;

/**
 * Attribute Model contains the current drawing instructions for any drawn object, including color, stipple, size, etc.
 * It can return a copy of the current instructions during object creation.
 * 
 * @author Senior Capstone
 */
public class AttributeModel {
	private static BasicShapeAttributes shapeAttr = new BasicShapeAttributes();
	private static double fontSize = 24d;
	public static final short STIPPLE_PATTERN_0 = -1;
	public static final short STIPPLE_PATTERN_1 = 255;
	public static final short STIPPLE_PATTERN_2 = 13107;
	public static final short STIPPLE_PATTERN_3 = 16179;
	public static final short STIPPLE_PATTERN_4 = 16371;

	public static BasicShapeAttributes getAttributes(){
		BasicShapeAttributes returnedAttr = new BasicShapeAttributes(shapeAttr);
		return returnedAttr;
	}
	public static void setAttributes(ShapeAttributes shapeAttributes){
		setInteriorColor(shapeAttributes.getInteriorMaterial());
		setOutlineColor(shapeAttributes.getOutlineMaterial());
		setLineWidth(shapeAttributes.getOutlineWidth());
		setFill(shapeAttributes.isDrawInterior());
		setInteriorOpacity(shapeAttributes.getInteriorOpacity());
		setOutlineOpacity(shapeAttributes.getOutlineOpacity());
		setLineStipple(shapeAttributes.getOutlineStipplePattern());
	}
	public static void setInteriorColor(Material color){
		shapeAttr.setInteriorMaterial(color);
	}
	public static void setOutlineColor(Material color){
		shapeAttr.setOutlineMaterial(color);
	}
	public static void setLineWidth(double width){
		shapeAttr.setOutlineWidth(width);
	}
	public static void setFill(boolean fill){
		shapeAttr.setDrawInterior(fill);
	}
	public static void setInteriorOpacity(double opacity){
		shapeAttr.setInteriorOpacity(opacity);
	}
	public static void setOutlineOpacity(double opacity){
		shapeAttr.setOutlineOpacity(opacity);
	}
	public static void setLineStipple(short stipple){
		shapeAttr.setOutlineStippleFactor(3);
		shapeAttr.setOutlineStipplePattern(stipple);
	}
	public static double getFontSize(){
		return fontSize;
	}
	public static void setFontSize(double size){
		fontSize = size;
	}

}
